//    Copyright (C) Kherty.  All rights reserved.
namespace OpenLS.Spreadsheet
{
    public class NotContainsTextFormattingRule : StandardConditionalFormattingRule
    {
        internal override ConditionalFormattingType Type
        {
            get { return ConditionalFormattingType.NotContainsText; }
        }
        internal override bool Apply(Cell cell)
        {
            return ApplyStyle(cell, !(cell.Value is string));
        }
        internal override void PrepareBeforeWrite(ConditionalFormatting conditionalFormatting, FormatType formatType)
        {
                            var cell = conditionalFormatting.Range.TopLeftCell;
            this.Formula1 = string.Format("=ISERROR(SEARCH(\"{0}\",{1}))", this.EscapedText, cell.Label);

        }
    }
}
